<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$this->model('model')->check_worker();
$_SESSION['forward_url']='jy_lianmerch/dindex/';
$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
$item['merchnum']=pdo_count('jy_merch_user',array('uniacid'=>$_SESSION['uniacid'],'jointime >'=>$daytime));
$item['ordernum']=pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime));
$item['orderfee']=pdo_getsum('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'createtime >'=>$daytime),'price');
$item['ipnum']= pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'plugin'=>array('jy_merch','jy_lianmerch'),'createtime >'=>$daytime));
$return['item']=$item;
$link_time[0]=0;
$link_time[1]=$daytime-3*24*3600;
$link_time[2]=$daytime-7*24*3600;
$link_time[3]=$daytime-15*24*3600;
$link_time[4]=$daytime-30*24*3600;
$link_time[5]=$daytime-90*24*3600;
$link_time[6]=$daytime-180*24*3600;
$link_times=$this->link_times;
$merchnums=array();
foreach($link_time as $lk=>$lv){
	$merchnums[$lk]['title']=$link_times[$lk].'商户';
	$merchnums[$lk]['num']=pdo_count('jy_merch_user',array('uniacid'=>$_SESSION['uniacid'],'jointime >='=>$lv));
}
$return['merchnums']=$merchnums;
$ordernums=array();
foreach($link_time as $lk=>$lv){
	$ordernums[$lk]['title']=$link_times[$lk].'订单';
	$ordernums[$lk]['num']=pdo_count('jy_weishop_order',array('ispay'=>1,'uniacid'=>$_SESSION['uniacid'],'createtime >='=>$lv));
}
$return['ordernums']=$ordernums;
$orderfees=array();
foreach($link_time as $lk=>$lv){
	$orderfees[$lk]['title']=$link_times[$lk].'业绩';
	$orderfees[$lk]['num']=pdo_getsum('jy_weishop_order',array('ispay'=>1,'uniacid'=>$_SESSION['uniacid'],'createtime >='=>$lv),'price');
}
$return['orderfees']=$orderfees;
$creditshop=array();
foreach($link_time as $lk=>$lv){
	$creditshop[$lk]['title']=$link_times[$lk].'业绩';
	$creditshop[$lk]['num']=pdo_getsum('jy_creditshop_log',array('paystatus'=>1,'uniacid'=>$_SESSION['uniacid'],'createtime >='=>$lv),'money');
}
$return['creditshop']=$creditshop;
$mjicai=array();
foreach($link_time as $lk=>$lv){
	$mjicai[$lk]['title']=$link_times[$lk].'业绩';
	$mjicai[$lk]['num']=pdo_getsum('jy_mjicai_canlog',array('uniacid'=>$_SESSION['uniacid'],'createtime >='=>$lv),'jifen');
}
$return['mjicai']=$mjicai;
$_SESSION['merchid']=0;
$_SESSION['onemerchid']=0;
set_html('title','数据中心');
exi($return);	
?>